package com.example.demo.controller;

import com.example.demo.service.WxTemplateService;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 消息模板推送
 */
@RestController
@RequestMapping("/wxTemplate")
public class WxTemplateController {

    @Resource
    private WxTemplateService wxTemplateService;

    @GetMapping("/sendTemplate")
    @ResponseBody
    public String sendTemplate(String message01, String message02) {

        if (StringUtils.isEmpty(message01) || StringUtils.isEmpty(message02)) {
            return "参数缺失";
        }

        wxTemplateService.sendTemplateToUsers(message01, message02);
        return "SUCCESS";
    }

}
